From 0d3c526e866e6160f4bc5a9b8e75c85ead8719ce Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 28 Mar 2005 21:15:47 +0000 Subject: [PATCH] bitkeeper revision 1.1159.258.73 (424874035MwIUi8jFNCdaLfnJCrWig) Fix cpu_relax/rep_nop to include a compiler barrier. This is needed for SMP booting with gcc 4.0, for example. Signed-off-by: Keir Fraser --- xen/arch/x86/memory.c | 5 +---- xen/arch/x86/setup.c | 3 --- xen/arch/x86/smp.c | 10 ++-------- xen/arch/x86/smpboot.c | 2 +- xen/common/schedule.c | 3 --- xen/include/asm-x86/processor.h | 4 ++-- 6 files changed, 6 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c index 4c91d7374b..e82f5aa8c8 100644 --- a/xen/arch/x86/memory.c +++ b/xen/arch/x86/memory.c @@ -904,10 +904,7 @@ int get_page_type(struct pfn_info *page, u32 type) { /* Someone else is updating validation of this page. Wait... */ while ( (y = page->u.inuse.type_info) == x ) - { - rep_nop(); - barrier(); - } + cpu_relax(); goto again; } } diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 6ef530c4e6..1de2e2d71d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -452,10 +452,7 @@ static void __init start_of_day(void) smp_threads_ready = 1; smp_commence(); /* Tell other CPUs that state of the world is stable. */ while ( wait_init_idle != 0 ) - { cpu_relax(); - barrier(); - } #endif watchdog_on = 1; diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index 65b126c1e9..120acaef00 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -239,10 +239,7 @@ void flush_tlb_mask(unsigned long mask) flush_cpumask = mask; send_IPI_mask(mask, INVALIDATE_TLB_VECTOR); while ( flush_cpumask != 0 ) - { - rep_nop(); - barrier(); - } + cpu_relax(); spin_unlock(&flush_lock); } @@ -260,10 +257,7 @@ void new_tlbflush_clock_period(void) flush_cpumask = ((1 << smp_num_cpus) - 1) & ~(1 << smp_processor_id()); send_IPI_allbutself(INVALIDATE_TLB_VECTOR); while ( flush_cpumask != 0 ) - { - rep_nop(); - barrier(); - } + cpu_relax(); spin_unlock(&flush_lock); } diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index f5aacca063..e3e152bb49 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -396,7 +396,7 @@ void __init start_secondary(void) smp_callin(); while (!atomic_read(&smp_commenced)) - rep_nop(); + cpu_relax(); /* * At this point, boot CPU has fully initialised the IDT. It is diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 9756b18512..0470f9ee17 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -166,10 +166,7 @@ void domain_sleep(struct domain *d) /* Synchronous. */ while ( test_bit(DF_RUNNING, &d->flags) && !domain_runnable(d) ) - { - smp_mb(); cpu_relax(); - } } void domain_wake(struct domain *d) diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index e3446aaeae..00b3259f98 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -571,10 +571,10 @@ struct extended_sigtable { /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ static inline void rep_nop(void) { - __asm__ __volatile__("rep;nop"); + __asm__ __volatile__ ( "rep;nop" : : : "memory" ); } -#define cpu_relax() rep_nop() +#define cpu_relax() rep_nop() /* Prefetch instructions for Pentium III and AMD Athlon */ #ifdef CONFIG_MPENTIUMIII -- 2.30.2